package com.hmall.api.clients;


import com.hmall.api.clients.fallback.ItemClientFallbackFactory;
import com.hmall.api.dto.ItemDTO;
import com.hmall.api.dto.OrderDetailDTO;
import com.hmall.common.utils.BeanUtils;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * 代理：发送商品服务请求
 */
@FeignClient(value = "item-service",fallbackFactory = ItemClientFallbackFactory.class)  //服务名称,回调降级处理逻辑
public interface ItemClient {

    @GetMapping("/items") //请求方式和路径
    List<ItemDTO> queryItemByIds(@RequestParam("ids") Set<Long> ids); //批量查询商品
    @PutMapping("/items/stock/deduct")
    public void deductStock(@RequestBody List<OrderDetailDTO> items);

    @GetMapping("/items/{id}")
    public ItemDTO queryItemById(@PathVariable("id") Long id);

}
